#include "zk_typedef.h"
#include "zk_font_file.h"

#include "../hal/hal_spi_flash.h"

static uint32 offset = 0;

uint32 font_file_open(const char *file)
{
    offset = 0;
    return 1;
}

uint32 font_file_seek(uint32 offset_t)
{
#ifdef ZK_DEBUG
    DEBUG_PRINT("font_file_seek : 0x%x%x\r\n", HI_UINT32(offset_t), LO_UINT32(offset_t));
#endif

    offset = offset_t;
    return 1;
}

uint32 font_file_read(void *pdata, uint16 size)
{
#ifdef ZK_DEBUG
    DEBUG_PRINT("font_file_read : %d , offset : 0x%x%x\r\n", size, HI_UINT32(offset), LO_UINT32(offset));
#endif

    SPI_Flash_Read(pdata, offset, size);
    offset += size;
    return 1;
}

void font_file_close()
{
    offset = 0;
}
